home *** CD-ROM | disk | FTP | other *** search
/ IRIX 6.3 Development Libraries / SGI IRIX 6.3 Development Libraries.iso / dist / dist6.3 / ViewKit_dev.idb / usr / include / Vk / VkColorChooserDialog.h.z / VkColorChooserDialog.h
C/C++ Source or Header  |  1996-09-20  |  4KB  |  153 lines

  1. ////////////////////////////////////////////////////////////////////////////////
  2. ///////   Copyright 1992, Silicon Graphics, Inc.  All Rights Reserved.   ///////
  3. //                                                                            //
  4. // This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;     //
  5. // the contents of this file may not be disclosed to third parties, copied    //
  6. // or duplicated in any form, in whole or in part, without the prior written  //
  7. // permission of Silicon Graphics, Inc.                                       //
  8. //                                                                            //
  9. // RESTRICTED RIGHTS LEGEND:                                                  //
  10. // Use,duplication or disclosure by the Government is subject to restrictions //
  11. // as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data     //
  12. // and Computer Software clause at DFARS 252.227-7013, and/or in similar or   //
  13. // successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -    //
  14. // rights reserved under the Copyright Laws of the United States.             //
  15. //                                                                            //
  16. ////////////////////////////////////////////////////////////////////////////////
  17.  
  18. #ifndef VKCOLORCHOOSERDIALOG_H
  19. #define VKCOLORCHOOSERDIALOG_H
  20.  
  21. #include <Vk/VkDialogManager.h>
  22. #include <Sgm/ColorC.h>
  23.  
  24. /*******************************************************
  25. CLASS
  26.     VkColorChooserDialog
  27.  
  28. OVERVIEW
  29.  
  30.  
  31.  
  32.  
  33.  
  34. AUTHOR
  35.    Doug Young
  36. ******************************************************/
  37.  
  38.  
  39. class VkColorChooserDialog : public VkDialogManager {
  40.  
  41.  public:
  42.  
  43.  
  44.     ////////////
  45.     //
  46.     //
  47.     VkColorChooserDialog( const char* name );
  48.  
  49.     ////////////
  50.     //
  51.     //
  52.     virtual ~VkColorChooserDialog();
  53.  
  54.  
  55.     ////////////
  56.     //
  57.     //
  58.     const char* className();
  59.  
  60.  
  61.     ////////////
  62.     //
  63.     //
  64.     XColor *getColor();                // Returns a shifted XColor
  65.     XColor *getXColor();            // Returns a normal XColor
  66.  
  67.  
  68.     ////////////
  69.     //
  70.     //
  71.     void setColor(short r, short g, short b); // same as setCurrent + setStored
  72.     void setXColor(unsigned short r, unsigned short g, unsigned short b);
  73.  
  74.  
  75.     ////////////
  76.     //
  77.     //
  78.     void setCurrentColor(short r, short g, short b);
  79.     void setCurrentXColor(unsigned short r, unsigned short g, unsigned short b);
  80.  
  81.  
  82.     ////////////
  83.     //
  84.     //
  85.     void setStoredColor(short r, short g, short b);
  86.     void setStoredXColor(unsigned short r, unsigned short g, unsigned short b);
  87.  
  88.  
  89.     ////////////
  90.     //
  91.     //
  92.     static const char *const valueChangedCallback;
  93.  
  94.   protected:
  95.  
  96.  
  97.     ////////////
  98.     //
  99.     //
  100.     virtual Widget createDialog( Widget dialogParent );
  101.  
  102.     ////////////
  103.     //
  104.     //
  105.     virtual void ok(Widget, XtPointer);
  106.  
  107.     ////////////
  108.     //
  109.     //
  110.     virtual void apply(Widget, XtPointer);
  111.  
  112.     ////////////
  113.     //
  114.     //
  115.     virtual void cancel(Widget, XtPointer);
  116.  
  117.     ////////////
  118.     //
  119.     //
  120.     virtual void drag(Widget, XtPointer);
  121.  
  122.     ////////////
  123.     //
  124.     //
  125.     virtual void valueChanged(Widget, XtPointer);
  126.  
  127.  
  128.     ////////////
  129.     //
  130.     //
  131.     void clearValues(VkCallbackObject *, void *, void*);
  132.  
  133.   private:
  134.  
  135.     static void dragCB(Widget, XtPointer, XtPointer);
  136.     static void valueChangedCB(Widget, XtPointer, XtPointer);
  137.     SgColorChooserCallbackStruct *_callData;
  138.  
  139.     // _currentColor points to an XColor[2].
  140.     //        _currentColor[0] is shifted, as expected by SgColorChooser
  141.     //        _currentColor[1] is shifted back, and returned, when called for
  142.     //    This means that _currentColor[1] is truly an XColor.
  143.     XColor *_currentColor;
  144.     XColor *_storedColor;        
  145. };
  146.  
  147. extern VkColorChooserDialog *getTheColorChooserDialog();
  148.     
  149. #define theColorChooserDialog getTheColorChooserDialog()
  150.  
  151.  
  152. #endif // VKCOLORCHOOSERDIALOG_H
  153.